package com.qf.controller;

import com.qf.annotation.RequiresPermissionsDesc;
import com.qf.pojo.DtsUser;
import com.qf.service.DtsOrderGoodsService;
import com.qf.service.DtsOrderService;
import com.qf.service.DtsUserService;
import com.qf.util.ResponseUtil;
import com.qf.vo.StatVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project E-commercebackGroundManagementSystem
 * @date 2022/9/25 15:32
 */
@RestController
@RequestMapping("/admin/stat")
@Slf4j
@CrossOrigin
public class StatController {
    @Autowired
    private DtsUserService dtsUserService;
    @Autowired
    private DtsOrderService dtsOrderService;
    @Autowired

    private DtsOrderGoodsService dtsOrderGoodsService;
    // http://localhost:8083/admin/stat/user
//    @RequiresPermissionsDesc(menu = {"统计","用户统计"},button ="查找")
//    @RequiresPermissions("admin:stat:user")
    @GetMapping("/user")
    public  Object User(){
        StatVo statVo = dtsUserService.selectDayAndUserCount();
        return ResponseUtil.ok(statVo);
    }
//    @RequiresPermissionsDesc(menu = {"推广管理","广告管理"},button ="查找")
//    @RequiresPermissions("admin:stat:list")
    @GetMapping("/order")
    public  Object order(){
        StatVo statVo=  dtsOrderService.selectCount();
        return  ResponseUtil.ok(statVo);
    }
//    @RequiresPermissionsDesc(menu = {"推广管理","广告管理"},button ="查找")
//    @RequiresPermissions("admin:stat:list")
    @GetMapping("/goods")
    public Object goods(){
       // String[] columns = new String[]{"day","orders","products","amount"};
        StatVo statVo= dtsOrderGoodsService.findGoodsStatRows();

        return ResponseUtil.ok(statVo);
    }
}
